#include <stdio.h>

int main()
{
    int x,y,z;
    for(x = 1;x <= 3;x++)
    for(y = 1;y <= 3;y++)
    for(z = 1;z <= 3;z++)
    if(x != 1 && x != 3 && z != 3 && x != y && x != z && y != z)
    {
        printf("X will marry to %c.\n",'A'+x-1);
        printf("Y will marry to %c.\n",'A'+y-1);
        printf("Z will marry to %c.\n",'A'+z-1);
    }
}